<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>合同修改</title>
</head>
<link rel="stylesheet" href="/static/layui/css/layui.css" />
<body>
<form class="layui-form"  action="" lay-filter="edit">
    <input type="hidden" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label">新密码：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="plain_password" id="plain_password"  required  lay-verify="required" placeholder="请输入新密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认密码：</label>
        <div class="layui-input-inline layui-col-md4">
            <input type="text" name="password" id="password"  required  lay-verify="required" placeholder="请确认密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
        </div>
    </div>
</form>
</body>
<script src="/static/js/system.js"></script>
<script src="/static/js/jquery-3.3.1.js"></script>
<script src="/static/layui/layui.js"></script>
<script>
    //Demo
    layui.use(['form','layer'], function(){
        var form = layui.form;
        /*$.ajax({
            url:"/UserServlet?action=toAddContr",
            type:"post",
            // data:{},
            dataType:"json",
            success:function (res) {
                console.log(res)
                $.each(res.date,function (i,obj) {
                    console.log(obj);
                    $("#h_id").append('<option value="'+obj.h_id+'" >' + obj.h_estate + obj.h_unitNumber+obj.h_roomNo +'</option>');
                });
                form.render('select'); //刷新select选择框渲染
            }
        });*/

        /*$.ajax({
            url:"/UserServlet?action=toAddLess",
            type:"post",
            // data:{},
            dataType:"json",
            success:function (res) {
                console.log(res)
                $.each(res.date,function (i,obj) {
                    console.log(obj);
                    $("#l_id").append('<option value="'+obj.l_id+'">'+ obj.l_name +'</option>')
                });
                form.render('select'); //刷新select选择框渲染
            }
        });*/


        //监听提交 15039939677
        form.on('submit(formDemo)', function(data){
            var data1 = form.val("edit");
            $.ajax({
                url:'/user/updatetow',
                type:"post",
                dataType:"json",
                data:data1,
                success:function (da) {
                    console.log(da)
                    if (da.code == 200) {
                        layer.alert("修改成功！", function () {
                            // window.parent.location.reload();//刷新父页面
                            // parent.layer.close(layer.index);//关闭弹出层
                            parent.layer.closeAll();
                        });
                    } else {
                        layer.msg("修改失败！");
                    }
                }
            });
            return false;
        });
    });
</script>
</html>